// flags/ai_role.go
package flags

import (
	"github.com/sirupsen/logrus"
	"muziai-server/global"
	"muziai-server/models"
)

type AiRoleFlag struct {
}

func (AiRoleFlag) CreateAiRole() {

	var systemRole models.AiRoleModel
	err := global.DB.Take(&systemRole, "is_system = ?", true).Error
	if err == nil {
		logrus.Warnf("已存在系统角色，本次不创建")
		return
	}

	global.DB.Create(&models.AiRoleModel{
		Title:    "默认角色",
		Category: "系统内置",
		Abstract: "",
		Prompt:   global.Config.AI.Prompt,
		IsSystem: true,
	})
	logrus.Infof("默认角色创建成功")

}
